<include file="public:header"/>
<include file="public:left"/>
<style>
    td{text-align:center;}
</style>
<section>
    <div class="page_title">
        <h2 class="fl" style="padding-right: 20px">服务产品</h2>
        <form action="" >
            <input type="text" class="page_title_input" name="keyword" placeholder="可搜索名称" value="{$keyword}">
            服务产品状态
            <select name="status">
                <option value="">全部状态</option>
                <option value="0" <eq name="status" value="0">selected </eq>>下架中</option>
                <option value="1" <eq name="status" value="1">selected </eq>>上架中</option>
            </select>
            服务产品类型
            <select name="type">
                <option value="">类型</option>
                <option value="0" <eq name="type" value="0">selected </eq>>房间</option>
                <option value="1" <eq name="type" value="1">selected </eq>>游泳馆</option>
                <option value="2" <eq name="type" value="2">selected </eq>>健身房</option>
            </select>

            <input  class="page_title_submit" type="submit" value="搜索">
        </form>
        <a class="fr" href="{:url('goods/post')}">添加服务产品</a>
    </div>
    <form class="form" action="{:url('goods/batch')}">
    <table class="table">
        <tr>
            <th><input type="checkbox" id="chooseall"></th>
            <th>id</th>
            <th>名称</th>
            <th>今日价格</th>
            <th>会员价</th>
            <th>库存</th>
            <th>图片</th>
            <th>状态</th>
            <th>类型</th>
            <th>顺序</th>
            <th>操作</th>
        </tr>


        <volist name="list" id="vo">
            <tr>
                <th><input type="checkbox" name="box[]" value="{$vo.id}"></th>
                <td  ><div class="cut_title ellipsis">{$vo.id}</div></td>
                <td>{$vo.title}</td>
                <td>{$vo.oprice}</td>
                <td>银卡：{$vo.price1}<br>
                    金卡卡：{$vo.price1}<br>
                    白金卡：{$vo.price1}<br>
                    黑金卡：{$vo.price1}<br></td>
                <td>{$vo.num}</td>
                <td><img src="__STATIC__/uploads/{$vo.image}" style="height: 40px;"></td>
                <td> <span title="点击更换状态"><eq name="vo.status" value="0">
                    <a href="{:url('goods/status',array('id'=>$vo['id']))}"> 下架中</a>
                    <else />
                    <a href="{:url('goods/status',array('id'=>$vo['id']))}"> 上架中</a>
                    </eq>
                   </span></td>
                <td><switch name="vo.type">
                    <case value="0">房间</case>
                    <case value="1">游泳馆</case>
                    <case value="2">健身房</case>
                </switch></td>
                <td>{$vo.sort}</td>
                <td>
                    <a href="{:url('goods/price',array('id'=>$vo['id']))}" class="inner_btn">价格</a>
                    <a href="{:url('goods/post',array('id'=>$vo['id']))}" class="inner_btn">编辑</a>
                    <a onclick="return confirm('删除数据会影响用户数据，确定删除？')" href="{:url('goods/del',array('id'=>$vo['id']))}" class="inner_btn">删除</a>
                </td>
            </tr>
        </volist>
        <input type="hidden" id="type" name="type" value="0">
    </table>
    </form>
<div style="margin-top: 10px">
    <span id="delete" style="width: 60px;display: block;border:1px solid #ccc;line-height: 40px;text-align: center;float: left;cursor: pointer">删除</span>
    <span id="shang" style="width: 60px;display: block;border:1px solid #ccc;line-height: 40px;text-align: center;float: left;cursor: pointer">上架</span>
    <span id="xia" style="width: 60px;display: block;border:1px solid #ccc;line-height: 40px;text-align: center;float: left;cursor: pointer ">下架</span>
</div>
    <div style="clear: both">
{$list->render()}
        </div>
</section>

<!--tabStyle-->
<script>
    $(document).ready(function(){
        //tab
        $(".admin_tab li a").click(function(){
            var liindex = $(".admin_tab li a").index(this);
            $(this).addClass("active").parent().siblings().find("a").removeClass("active");
            $(".admin_tab_cont").eq(liindex).fadeIn(150).siblings(".admin_tab_cont").hide();
        });
            $("#chooseall").click(function(){
                var checked=$(this).is(":checked",true)
                if(checked){
                    $("input[type=checkbox]").prop('checked',true)
                }else {
                    $("input[type=checkbox]").prop('checked',false)
                }
            })
            $("#delete").click(function() {
                $("#type").val(0);
                if(confirm('删除数据无法恢复，并且会影响用户数据，确定删除？')){
                    $(".form").submit();
                }
            })
        $("#shang").click(function() {
            $("#type").val(1);
                $(".form").submit();
        })
        $("#xia").click(function() {
            $("#type").val(2);
            $(".form").submit();
        })

    });
</script>


</div>
</section>
</body>
</html>
